﻿using System;
using System.Collections.Generic;
using System.Linq;
using MoreMountains.Feedbacks;
using UnityEngine;

namespace Gp.Scripts.Core {
    
    public class GeneralFxPlayer : MonoBehaviour {
        [SerializeField] private List<PlayerWrapper> players;



        public float Play(FxCode code, Vector3 pos) {
            var player = players.FirstOrDefault(x => x.code == code).player;
            if (player == null) return 0;
            
            
            player.PlayFeedbacks(pos);
            return player.TotalDuration;
        }

        





        [Serializable]
        private struct PlayerWrapper {
            public FxCode code;
            public MMF_Player player;
        }
    }
}